package xio.ccf_201703;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 *  ccf 201703-2 学生排队 100分
 * Created by Xio on 2017/10/31 0031.
 */
public class StudentQueueUp {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        List<Integer> list = new ArrayList<>();
        for (int i = 0; i <= n; i++) {
            list.add(i);
        }

        for (int i = 0; i < m; i++) {
            Integer num = sc.nextInt();
            int move = sc.nextInt();
            int index = list.indexOf(num);
            list.remove(num);
            list.add(index+move,num);
        }

        for (int i = 1; i < list.size(); i++) {
            System.out.printf(list.get(i)+" ");
        }
    }
}
